import JSEncrypt from 'jsencrypt/bin/jsencrypt.min'

// 密钥对生成 http://web.chacuo.net/netrsakeypair

// const pubKey =
//   'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQClDvYy8/9TtotqQsElqvGaggz/sjvFi3DHd2PJq3L1MEZJMGhx65vFiClAMfvqY/UiN7Uel9JQeSVCv7z33c6A5gqPSzWyZ8Fmg2CYwJrahYCnW8mkIDqdLsduKYy4UN4gds62bsiylkVeb8tzKOkriFVX3514Von6XFNHQPM5iwIDAQAB'
const pubKey =
  'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQClDvYy8/9TtotqQsElqvGaggz/sjvFi3DHd2PJq3L1MEZJMGhx65vFiClAMfvqY/UiN7Uel9JQeSVCv7z33c6A5gqPSzWyZ8Fmg2CYwJrahYCnW8mkIDqdLsduKYy4UN4gds62bsiylkVeb8tzKOkriFVX3514Von6XFNHQPM5iwIDAQAB'
// 加密
export function encrypt(txt) {
  const encryptor = new JSEncrypt()
  encryptor.setPublicKey(pubKey) // 设置公钥
  return encryptor.encrypt(txt) // 对数据进行加密
}
